import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src'),
    },
  },
  build: {
    rollupOptions: {
      output: {
        manualChunks: {
          vendor: ['vue', 'vue-router'],
          ui: ['element-plus'],
          editor: ['codemirror'],
          ai: ['openai'],
          git: ['isomorphic-git']
        }
      }
    },
    chunkSizeWarningLimit: 1000
  },
  esbuild: {
    // 跳过TypeScript类型检查以加快构建速度
    target: 'es2020'
  }
})